<template>
	<view class="team">
		<view class="li" v-for="(item,index) in list" :key="index">
			<image :src="item.avatarUrl" mode=""></image>
			<view class="dd">
				<view>{{item.nickName}}</view>
				<text>加入时间：{{item.join_time}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1
			}
		},
		onLoad(query) {
			this.get_server()
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.list = []
			this.page = 1
			this.get_server()
		},
		// 上拉加载
		onReachBottom: function() {
			this.get_server()
		},
		methods: {
			get_server() {
				this.$net.req('/user/getTeamList', {
					"page": this.page,
					"limit": 10
				}, false).then(res => {
					if (res.code == 200) {
						if(this.page==1){
							this.list = res.data.list
						}else{
							this.list  =this.list.concat(res.data.list)
						}
						
						if (res.data.list.length > 0) {
							++this.page
						} else if (this.queryParams.page > 1) {
							uni.showToast({
							    title: '暂无数据',
							    duration: 2000,
								icon:'none'
							});
						}
						
					}
				})
			}
		}
	}
</script>
<style>
	page {
		width: 100%;
		height: 100%;
		background: #FFFFFF;
	}
</style>
<style lang="scss" scoped>
	.team {
		width: 100%;
		padding: 12px;
		box-sizing: border-box;

		.li {
			width: 100%;
			display: flex;
			padding: 12px 0;

			image {
				width: 48px;
				height: 48px;
				border-radius: 50%;
			}

			.dd {
				margin-left: 10px;

				view {
					font-size: 16px;
					font-family: HarmonyOS_Sans_SC_Medium;
					color: #333333;
				}

				text {
					font-size: 12px;
					font-family: HarmonyOS_Sans_SC;
					color: #999999;
					margin-top: 6px;
				}
			}
		}
	}
</style>
